//
//  ViewController.m
//  CumtomerCamerProject
//
//  Created by 蓓蕾 on 2021/11/23.
//

#import "ViewController.h"
#import "CameraViewController.h"
#import "RotateCameraViewController.h"

#define kScreenWidth [UIScreen mainScreen].bounds.size.width
#define kScreenHeight [UIScreen mainScreen].bounds.size.height

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    NSLog(@"成功启动");
    self.view.backgroundColor = [UIColor whiteColor];
    UIButton *cameraView = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:cameraView];
    cameraView.frame = CGRectMake(kScreenWidth / 2 - 50, 70, 100, 50);
    cameraView.backgroundColor = [UIColor orangeColor];
    cameraView.tag = 1;
    [cameraView setTitle:@"拍照" forState:UIControlStateNormal];
    cameraView.titleLabel.font = [UIFont systemFontOfSize:20];
    [cameraView addTarget:self action:@selector(enterCameraMethod:) forControlEvents:UIControlEventTouchUpInside];
    
    
    UIButton *cameraTwoView = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:cameraTwoView];
    cameraTwoView.frame = CGRectMake(kScreenWidth / 2 - 50, CGRectGetMaxY(cameraView.frame) + 20, 100, 50);
    cameraTwoView.backgroundColor = [UIColor orangeColor];
    cameraTwoView.tag = 2;
    [cameraTwoView setTitle:@"拍照(横竖屏)" forState:UIControlStateNormal];
    cameraTwoView.titleLabel.font = [UIFont systemFontOfSize:20];
    [cameraTwoView addTarget:self action:@selector(enterCameraMethod:) forControlEvents:UIControlEventTouchUpInside];
}

-(void)enterCameraMethod:(UIButton *)sender
{
    NSInteger tag = sender.tag;
    switch (tag) {
        case 1:
        {
            CameraViewController *cameraVC = [[CameraViewController alloc] init];
            cameraVC.navigationItem.title = @"相机";
            [self.navigationController pushViewController:cameraVC animated:YES];
        }
            break;
        case 2:
        {
            RotateCameraViewController *cameraVC = [[RotateCameraViewController alloc] init];
            cameraVC.navigationItem.title = @"相机";
            [self.navigationController pushViewController:cameraVC animated:YES];
        }
            break;
            
        default:
            break;
    }
    
}


@end
